﻿@{
    ViewBag.Title = "用户注册";
}
@using (Ajax.BeginForm("Register", null, new AjaxOptions() { HttpMethod = "POST", OnSuccess = "OnSuccess", OnFailure = "OnFailure" }, new { id = "loginForm" }))
{
    <div class="form-group has-feedback">
        <input type="text" class="form-control" name="UserName" placeholder="请输入登录账号">
    </div>
    <div class="form-group has-feedback">
        <input type="password" class="form-control" name="Password" placeholder="请输入登录密码">
    </div>
    <div class="form-group has-feedback">
        <input type="password" class="form-control" name="Password2" placeholder="再次输入密码">
    </div>
    <div class="form-group has-feedback">
        <input type="text" class="form-control" name="NickName" placeholder="请输入称呼">
    </div>
    <div class="form-group has-feedback">
        <input type="text" class="form-control" name="Phone" placeholder="请输入联系电话">
    </div>
    <div class="form-group has-feedback">
        <input class="btn btn-lg btn-success btn-block" type="submit" value="确定注册" />
    </div>
}
@section scripts{
    <script type="text/javascript">
        function OnSuccess(data) {
            if (data) {
                var returl = '@Request["ReturnUrl"]';
                if (data.status == 1) {
                    alert("注册成功");
                    if (returl && returl != '') {
                        location.href = '@Request["ReturnUrl"]';
                    } else {
                        location.href = '@Url.Action("index", "home")';
                    }
                }
                else if (data.status == 3) {
                    location.href = '@Url.Action("index", "Manager")';
                }
                else {
                    alert(data.message);
                }
        }
    }
    </script>
}
